/**
 * 设置覆盖全局变量
 * @param options
 */
export function setCssRootVar(options: SetCssRootVar.Options) {
  for (let k in options) {
    const key = k as keyof SetCssRootVar.Options;
    const value = options[key];
    if (!value) document.documentElement.style.removeProperty(key);
    else document.documentElement.style.setProperty(key, value);
  }
}

export namespace SetCssRootVar {
  export type Size = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
  export type Mode = "gap-" | "T-S-" | "R-";
  export type Options = {
    [key in `--${Mode}${Size}`]?: string | undefined | null;
  };
}
